﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupLossDamage.aspx.cs" Inherits="MTRC.ODMS.Web.SOM.Popup.PopupLossDamage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Operational Data Management System</title>
    <base target="_self" />
    <!--base target="_parent"-->
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" /> 
    <script type="text/jscript">
    
    </script>
<style type="text/css">
    .TableTD1
    {
        height: 30px; 
        width: 100px;
    }
    
    .TableTD2
    {
        height: 30px; 
        width: 200px;
    }
</style>

    <script language="javascript">
   
    function btnOKClick(strLossQtyLargeThanZeroMsg, strLossQtyShouldLessThanLoanQtyMsg, hdnLossDamageQtyControlName, hdnLossDamageRemarkControlName)
    {
        //debugger;
        var tempValue;
        var lossAmount; 
        var loanAmount;
        tempValue=document.getElementById("txtNumOfLossItem").value;
        if(tempValue == "")
        {
            lossAmount = 0;
        }
        else
        {
            lossAmount = tempValue;
        }
        
        tempValue=document.getElementById("hdnNumOfLoanItem").value;
        if(tempValue == "")
        {
            loanAmount = 0;
        }
        else
        {
            loanAmount = tempValue;
        }
        
        //debugger;
        if( parseInt(lossAmount) <= 0 || parseInt(lossAmount) > parseInt(loanAmount))
        {
            alert(strLossQtyShouldLessThanLoanQtyMsg);
            return false;
        }
        else
        {
            //dialogArguments.document.getElementById("lblAssetLoanEventTimeVal").innerHTML=arrivalDate + " " + arrivalTime;
            //dialogArguments.document.getElementById("hdnLossDamageQty").value = lossAmount;
            //dialogArguments.document.getElementById("hdnLossDamageRemark").value = tempValue;
            dialogArguments.document.getElementById(hdnLossDamageQtyControlName).value = lossAmount;
            tempValue=document.getElementById("txtLossDamageRemark").value;
            dialogArguments.document.getElementById(hdnLossDamageRemarkControlName).value = tempValue;
            
            //__doPostBack(dialogArguments.document.getElementById(hdnLossDamageQtyControlName).id, "onserverchange"); //trigger oField's event
            window.returnValue='1'; //big use for this function
            window.close();
            
            return true;  //no actual use
        }
    }
    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="95%" style="margin-left: 5px;" >
            <tr>
                <td class="TableTD1">
                    <%--<INPUT id="hdnTempValue" type="hidden" name="hdnTempValue" value="" runat="server" />--%>
                    <asp:Label ID="lblLoanItemLbl" runat="server" Text="Loan Item:"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="lblLoanItemVal" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="TableTD1">
                    <%--<INPUT id="hdnTempValue" type="hidden" name="hdnTempValue" value="" runat="server" />--%>
                    <asp:Label ID="lblNumOfLossItemLbl" runat="server" Text="Number of Loss/Damage:"></asp:Label>
                    <em>*</em>
                </td>
                <td>
                    <asp:TextBox ID="txtNumOfLossItem" MaxLength=8 runat="server" Width="100px" onkeyup="value=value.replace(/[^\d]/g,'');"  CssClass="InputTextBox" Text=""></asp:TextBox>
                    <INPUT id="hdnNumOfLoanItem" type="hidden" name="hdnNumOfLoanItem" runat="server" />
                </td>
            </tr>
            <tr>
                <td  class="TableTD1" nowrap valign="top">
                    <asp:Label ID="lblRemark" runat="server" Text="Remark:"></asp:Label>
                    <%--<em>*</em>--%>
                </td>
                <td>
                    <asp:TextBox ID="txtLossDamageRemark" runat="server" Width="250px" CssClass="InputTextBox" Rows="4" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td colspan=2 align="center" style="height: 10px;">
                </td>
            </tr>
            <tr>
                <td colspan=2 align="center">
                    <asp:button id="btnOK" runat="server" Class="button" Text="OK"></asp:button>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:button id="btnCancel" runat="server" Class="button" Text="Cancel" OnClientClick="window.close(); return false;"></asp:button>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:button id="btnClose" runat="server" Class="button" Text="Close" OnClientClick="window.close(); return false;"></asp:button>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
